- 
                Notifications
    You must be signed in to change notification settings 
- Fork 803
Structlog and Loguru Handlers with Examples #2492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…tly - Caroline Gilbert
Structlog testing
Structlog testing
Loguru handler working
Handler examples
Updated tox documentation
| 4. Make sure you have `tox` installed. `pip install tox==4.13.0`. | ||
| 5. Change Python version to 3.11 | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not look generic enough
| Thanks for contributing but all 3 of you need to sign he CLA in order to get the code accepted | 
| ) | ||
|  | ||
| logger_provider.add_log_record_processor( | ||
| BatchLogRecordProcessor(exporter, max_export_batch_size=1) | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally we should allow users to pass in whatever record processor they want to use
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason to include that in this PR? It doesn't look like this is a feature in the logging handler
| Thanks for the change. I might be missing some context, but perhaps consider splitting this into two PRs, one for loguru and the other for structlog. Multiple, smaller PRs tend to get through the review process faster than fewer larger ones. | 
| Can this be merged if everything is ok? | 
| ) | ||
| set_logger_provider(logger_provider) | ||
|  | ||
| # Replace the standard logging configuration with Loguru | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is a typo
Replace the standard logging configuration with Loguru -> Replace the standard logging configuration with StructLog
| 
 This should be splitted per #2492 (comment) | 
| PR has been abandoned: open-telemetry/opentelemetry-python#2993 (comment) Anyone can feel free to pick up this work :) | 
| If the PR is ready to merge, why not merge it as it is ? @xrmx | 
| 
 @lzchen I'd like to help but I'm a bit at loss with the status and expectations on this issue, I see @znd4 did most of the work here. Can you provide some guidance here on what is missing and what is expected? I have some time available and a need to use this at the company I'm working for. On Delgan/loguru#674 there was a discussion about the instrumentation/formatting part of the integration. I'm now researching using an exporter to send logs through grpc/http. Anyways, how can I help? Should I rebase #2906 we do a round of review and go from there? | 
Description
Implemented unit tests for an existing structlog handler PR and implemented a log handler for the Loguru logging library located in the handlers directory. The tests are located in the opentelemetry-instrumentation-logging test_logging.py file to be compatible with the tox testing framework.
Built basic example OTel applications that use the structlog and loguru handlers to provide guidance on how to implement the handlers.
Dependencies Required: structlog, loguru
Fixes # (issue)
#2139
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Does This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.